Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development


Defining UI events for the viewer

You can define UI events to which you associate code to execute when the event occurs. This is how you get a user interface trigger in a dynamic object to run procedural code in a custom super procedure that you attach to the object. You can define these events either in the Repository Maintenance tool or, more simply, in the dynamic property sheet.

To define UI events for the window in the Repository Maintenance tool:

  1. Open the Repository Maintenance tool.
  2. Select the dynamic viewer customerviewv and expand it down to its Object Instances. When you expand Object Instances, you see the field-level objects representing all the fields in the viewer.
  3. Expand the Customer.CreditLimit node to see subnodes for its attributes and for its UI Events.
  4. Expand the UI Events node to see that none are defined, as shown:
  5. Right-click on the UI Events node and select the Add UI Events pop-up button that appears.
  6. The maintenance frame that then appears on the right allows you to define one or more UI events for the CreditLimit field. These are the fields you must fill in:

    • Event Name — This is the name of the Progress 4GL event you want to associate code with, for example: ENTRY, LEAVE, VALUE-CHANGED.
    • Action Type — Type RUN if you want to run an internal procedure when the event occurs. Type PUBLISH if you want to publish a Progress named event when the UI event occurs (which could be an ADM2 event such as fetchNext or some named event you have defined yourself, and to which your object subscribes). These are the only two valid values for Action Type.
    • Action Target — This defines the context in which the event should occur. You can specify one of the values in the following table for the Action Target:
    • SELF
      This means that the event should be run or published in the context of the object the code is serving, which effectively means it will be executed in the TARGET-PROCEDURE of the custom super procedure.
      CONTAINER
      This means that the event should be run or published in the context of the object that contains the object the custom super procedure is attached to; this is effectively the Container-Source of the object, normally its dynamic SmartWindow.
      ANYWHERE
      This value is valid only if the Action Type is PUBLISH, which means that the PUBLISH will be done from the custom super procedure itself and not FROM TARGET-PROCEDURE or FROM <ContainerHandle>. Since objects do not (and should not) normally subscribe to named events in super procedures directly, this effectively means that the event will be received only by an object that subscribes to it with the keyword ANYWHERE, meaning from any publisher.
      AS
      This and all the remaining values are valid only if the Action Type is RUN. The value AS means that the action will be run in the default AppServer handle for the client session.
      SM
      This value means that the action will be run in the Session Manager.
      SEM
      This value means that the action will be run in the Security Manager.
      PM
      This value means that the action will be run in the Profile Manager.
      RM
      This value means that the action will be run in the Repository Manager.
      TM
      This value means that the action will be run in the Translation/Localization Manager.
      GM
      This value means that the action will be run in the General Manager.

    • Event Parameter — This is the value of an optional parameter of type CHARACTER that will be passed to the procedure when run or published, if specified. If this is not specified, then the procedure is run or the event is published with no INPUT parameter.
    • Event Action — This is the name of the internal procedure to be RUN, or the named event to be published.
    • Event Disabled — If this toggle box is activated, then the event is disabled and will not occur.

To define a LEAVE event for the CreditLimit field that will execute the same check that happens on RowDisplay:

  1. Type LEAVE for the Event Name, type RUN for the Action Type, type SELF for the Action Target, and type CreditLimitLeave for the name of the Event Action procedure. Leave the Event Parameter blank and do not activate the Event Disabled toggle box, as shown:
  2. Press the Save button to register your event in the Repository.

To use the Dynamic property sheet to define events:

  1. Open the dynamic viewer in the AppBuilder and select the CreditLimit field in the design window.
  2. Open the Dynamic property sheet from the Windows menu.
  3. Select the Events folder tab in the property sheet and enter the same values as described above for the Leave event of the Credit Limit field.

Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095